<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0px;
            padding: 0px;
        }
        .box {
            position: absolute;
        }
       
        #heng {
            height: 150px;
            width: 100%;
            background: rgba(0, 0, 0, 0.5);
            position: absolute;
            top: 20px;
        }

        .picture{
            margin: 25px 5px 0px 5px;
            width: 150px;
            height: 100px;
            float: left;
            border: 2px solid white;
        }

        .up {
            z-index: 10;
            position: absolute;
            top: 40px;
            left: 300px;

        }

        .next {
            z-index: 10;
            position: absolute;
            top: 40px;
            left: 1200px;
        }

        #pic {
            width: 820px;
            height: 150px;
            position: absolute;
            left: 370px;
            overflow: hidden;
        }
        #btn{
            position: absolute;
            top: 10px;
            right: 50px;
            transition: 0.5s;
        }
        #btn:hover{
            top: 50px;
        }
    </style>
</head>

<body>
    <div class="box">
        <img src="../imgs/1.jpg" id="im">
        <div id="heng">
            <img src="../imgs/up.png" class="up" id="left">
                <div id="pic">
                    <div id="allpic">
                            <img src="../imgs/1.jpg" class="picture">
                            <img src="../imgs/2.jpg" class="picture">
                            <img src="../imgs/3.jpg" class="picture">
                            <img src="../imgs/4.jpg" class="picture">
                            <img src="../imgs/5.jpg" class="picture">
                            <img src="../imgs/6.jpg" class="picture">
                            <img src="../imgs/7.jpg" class="picture">
                            <img src="../imgs/8.jpg" class="picture">
                            <img src="../imgs/9.jpg" class="picture">
                            <img src="../imgs/10.jpg" class="picture">
                            <img src="../imgs/11.jpg" class="picture">
                    </div>
                </div>
            <img src="../imgs/next.png" class="next" id="right">
        </div>
        <img src="../imgs/pick1.png" id="btn">
    </div>
</body>

<script src="../jq.min.js"></script> 
<script>
    var handle=0
    var handle1=0
    $("#btn").click(function(){
        if(handle==0){
            $("#heng").attr("style","height:0px;transition: 0.5s;")
            $("#pic").attr("style","height:0px;transition: 0.5s;")
            $("#left").attr("style","height:0px;transition: 0.5s;")
            $("#right").attr("style","height:0px;transition: 0.5s;")
            $(this).attr("src","../imgs/pick.png")
            handle=1
        }else{
            $("#heng").attr("style","height:150px;transition: 0.5s;")
            $("#pic").attr("style","height:150px;transition: 0.5s;")
            $("#left").attr("style","height:64px;transition: 0.5s;")
            $("#right").attr("style","height:64px;transition: 0.5s;")
            $(this).attr("src","../imgs/pick1.png")
            handle=0
        }//收缩
    })
    $("#left").click(function(){
        if(handle1==0){
            $("#allpic").attr("style","margin-left:-1000px;transition: 0.5s;")
            handle1=1
        }else{
            $("#allpic").attr("style","margin-left:0px;transition: 0.5s")
            handle1=0
        }//左右移动
    })
    $("#right").click(function(){
        if(handle1==0){
            $("#allpic").attr("style","margin-left:-1000px;transition: 0.5s;")
            handle1=1
        }else{
            $("#allpic").attr("style","margin-left:0px;transition: 0.5s")
            handle1=0
        }
    })//左右移动
    $(".picture").click(function(){
        var index=$(this).index()
        $("#im").attr("src",`../imgs/${index+1}.jpg`)
    })//背景切换
</script>
</html>